package com.hygj.service.impl;

import com.hygj.baseUtil.BaseDao;
import com.hygj.baseUtil.BaseServiceImpl;
import com.hygj.pojo.Role;
import com.hygj.service.RoleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

@Service("roleService")
public class RoleServiceImpl extends BaseServiceImpl<Role> implements RoleService {
    
	@Resource(name="roleDao")
	@Override
	public void setDao(BaseDao<Role> dao) {
		// TODO Auto-generated method stub
		super.setDao(dao);
	}


	@Override
	public void delete(Integer[] ids) {
		Map<String, Object> params = new HashMap<String, Object>();
		if(ids.length > 0){
			for(Integer rid: ids){
				//给userMapper 传id值  通过 params
				params.put("rid", rid);
				delete("delete",rid);

			}

		}

	}

	@Override
	public Set<Role> selectRoles(Integer rid) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("rid", rid);
		return (Set<Role>) find("finds",params);
	}

}
